import Vue from "vue";
import VueRouter from "vue-router";
import Layout from '@/components/layout/index.vue'

Vue.use(VueRouter);
const routes = [
    {
        path: "/",
        component: Layout,
        meta: {
            title: ""
        },
        children: [
            {
                path: "/",
                component: resolve => require(["@/views/home/index.vue"], resolve),
                meta: {
                    title: ""
                }
            },
            {
                path: "home",
                component: resolve => require(["@/views/home/home.vue"], resolve),
                meta: {
                    title: ""
                }
            },
        ],
    }
];

const router = new VueRouter({
    mode: "history",
    routes
});

router.beforeEach((to, from, next) => {
    if (to.meta.title) {
        document.title = to.meta.title
    }
    next()
})
export default router;